package solution6;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Solution solution = new Solution();
//        System.out.println("".toCharArray().length);
        while (sc.hasNext()) {
            String s = sc.nextLine(); // next()不包括空格
            int nRows = sc.nextInt();
//            System.out.println(s.toCharArray().length);// 测试""时，用sc.nextLine(),用2行输入
            System.out.println(solution.convert2(s, nRows));
        }
    }
}
